module.exports = function ($scope, $resource, toaster){

    $scope.options1 = {
        legend: {
            display : true,
            position : 'right'
        }
	};

    $resource('/api/ac/goc/dataAnalysisService/singleData', {}, {}).save({'type':'10'}, function (res) {
        console.log(res);

        if (res.errcode !== 0) {
            toaster.error({title: '', body: res.errmsg});
            return;
        }

        $scope.labels = res.data.labels;
        $scope.data = res.data.data;
        $scope.colors = [];
        for(var i in res.data.labels) {
            $scope.colors.push("#5bc0de");
        }

    });

    $resource('/api/ac/goc/dataAnalysisService/singleData', {}, {}).save({'type':'12'}, function (res) {
        console.log(res);

        if (res.errcode !== 0) {
            toaster.error({title: '', body: res.errmsg});
            return;
        }

        $scope.labels1 = res.data.labels;
        $scope.data1 = res.data.data;
        $scope.colors1 = [];
        for(var i in res.data.labels) {
            $scope.colors1.push("#5bc0de");
        }

    });

    $resource('/api/ac/goc/dataAnalysisService/singleData', {}, {}).save({'type':'13'}, function (res) {
        console.log(res);

        if (res.errcode !== 0) {
            toaster.error({title: '', body: res.errmsg});
            return;
        }

        $scope.labels2 = res.data.labels;
        $scope.data2 = res.data.data;
        $scope.colors2 = [];
        for(var i in res.data.labels) {
            $scope.colors2.push("#5bc0de");
        }

    });

    $resource('/api/ac/goc/dataAnalysisService/singleData', {}, {}).save({'type':'13'}, function (res) {
        console.log(res);

        if (res.errcode !== 0) {
            toaster.error({title: '', body: res.errmsg});
            return;
        }

        $scope.labels3 = res.data.labels;
        $scope.data3 = res.data.data;

    });

};